<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Document</title>

    <style>
        .ad {
            position: fixed;
            right: 0;
            bottom: 0;
            width: 100px;
            height: 100px;
            background-color: red;
        }

        .shut {
            position: absolute;
            top: 0px;
            right: 5px;
            cursor: pointer;
        }
    </style>
</head>
<body>

    <div class="ad">
        我是广告
        <div class="shut">
            x
        </div>
    </div>

<script>
    let btn = document.querySelector(".shut")
    btn.addEventListener("click", function() {
    this.parentNode.style.display = "none"
    })
</script>
</body>
</html>